<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : rv_100_03.jsp
    Description : 참여후기 수정 (관리자)
    author Ki min
    since 2012. 7. 23.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 7. 23.     Ki min             최초 생성
--%>

<%@ include file="/WEB-INF/jsp/co/mn/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/co/mn/include/session.jspf" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/co/mn/include/header.jspf" %>
<script type="text/javaScript" language="javascript">
$(document).ready(function() {    
    /* form validation check */
    onloadCharCheck();
    
    /* List Page 이동 */
    $("#listButn").bind("click", moveListPage);
    /* Form Submit */
    $("#rgstButn").bind("click", blcSubm);
    /* Form 초기화 */
    $("#cnclButn").bind("click", formIniz);
    /* 편지지 선택  */
    $(":radio[name='ltrScnCd'][value='${result.ltrScnCd }']").attr("checked", true);
    /* 공개 여부 선택 */
    $(":radio[name='oppbYn'][value='${result.oppbYn }']").attr("checked", true);
});

/*
 * 리스트페이지 이동
 */
function moveListPage() {
    $("#hiddenForm").attr('action','/rv_100_01.do').submit();
}

/*
 * Form Submit
 */
function blcSubm() {
    if (!validateForm($("#mainForm"))) {
        return;
    } 
    
    if (!isSchrChk($("#title").val())) {
        alert("[제목] 은 특수문자(!#$%^&*|'<>-;)를 입력할 수 없습니다.");
        $("#title").focus();
        return;
    }
    
    if (getTxtBkmgRmov($("#sbc").val())=="") {
        alert("[내용] 을 입력해주세요.");
        $("#sbc").focus();
        return;
    }
    if(confirm("수정 하시겠습니까?")){  
        $("#mainForm").attr('target','comIframe');
        $("#mainForm").attr('action','/rv_100_06.do');
        $("#mainForm").submit();
    }
}

/*
 * Form 초기화
 */
function formIniz() {
    $("form").each(function(){
       this.reset(); 
    });
}
</script>
</head>
<body>
        <div id="contents">
            <p class="msgRequired"><span>*</span>표시는 필수 입력항목입니다</p>
            <form id="hiddenForm" name="hiddenForm" method="post">
                <%-- request --%>
                <input type="hidden" id="blbIdx" name="blbIdx" value="${result.blbIdx }" />
                <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
            </form>
            <form id="mainForm" name="mainForm" method="post" enctype="multipart/form-data">
            <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
            <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
            <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
            <input type="hidden" id="blbIdx" name="blbIdx" value="${result.blbIdx }" />
            <table border="1" class="frmTable" summary="CSR 소식 관리의 제목,구분,첨부파일,내용,메인썸네일을 입력 또는 등록하는 표">
                <col width="25%" />
                <col width="25%" />
                <col width="25%" />
                <col width="25%" />
                <tbody>
                <input type="hidden" id="thumnImgPath" name="thumnImgPath" value="${result.thumnImgPath }" />
                    <tr>
                        <th><sup>*</sup>이름</th>
                        <td><input style="width:150px;" type="text" name="pprrNm" title="이름" value="${result.pprrNm }" nullable="true"/></td>
                        <td class="subThead"><sup>*</sup>공개여부</td>
                        <td>
                            <span class="radioArea">
                                <label for="checkClosed"><input type="radio" id="oppbYn" name="oppbYn" value="N" />비공개</label>
                                <label for="checkOpen"><input type="radio" id="oppbYn" name="oppbYn" value="Y"  />공개</label>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <th><sup>*</sup>이메일</th>
                        <td colspan="3"><input type="text" class="frmEmail" name="eml1" title="이메일" nullable="true" value="${eml1 }" /> &#64; <input type="text" class="frmEmail" name="eml2" title="이메일" nullable="true" value="${eml2 }"  /></td>
                    </tr>
                    <tr>
                        <th><sup>*</sup>연락처</span></th>
                        <td colspan="3">
                            <input type="text" class="frmCall" name="hp1" title="연락처" nullable="true" value="${hp1 }" /> - <input type="text" class="frmCall" name="hp2" title="연락처" nullable="true" value="${hp2 }" /> - <input type="text" class="frmCall" name="hp3" title="연락처" nullable="true" value="${hp3 }" />
                        </td>
                        </tr>
                    <tr>
                        <th><sup>*</sup>제목</th>
                        <td colspan="3"><input type="text" id="title" name="title" title="제목" value="${result.titl }" nullable="true" /></td>
                    </tr>
                    <tr>
                        <th>정렬순서</th>
                        <td colspan="3">
                            <select id="sortNum" name="sortNum" style="width:90px;">
                                <option value="1" <c:if test="${result.sortNum == 1 }"><c:out value="selected"/></c:if>>일반노출</option>
                                <option value="0" <c:if test="${result.sortNum <1 }"><c:out value="selected"/></c:if>>우선노출</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>첨부파일</th>
                        <td colspan="3">
                            <div class="imgUpload">
                                <p><input type="file" name="attcFile" size="26" /></p>
                            </div>
                            <c:if test="${result.filPath != 'image' && !empty result.filNm }">
                                <p class="attachedFile"><a href="#" onclick="getUpFileDownload('0050','${result.blbIdx}');return false;" class="attach">${result.filNm }</a></p>
                            </c:if>
                            <c:if test="${result.filPath == 'image' && !empty result.filNm }">
                                <p class="attachedFile"><a href="#" onclick="getImgPopup('/upfile/${result.filPath }/${result.filNm}');return false;" class="attach">${result.filNm }</a></p>
                            </c:if>
                        </td>
                    </tr>
                    <tr>
                        <th>편지지</th>
                        <td colspan="3" class="letter">
                            <span class="radioArea">
                                <label for="chckLetter1"><input type="radio" id="ltrScnCd" name="ltrScnCd" value="A" /><span class="letter1">편지지A</span></label>
                                <label for="chckLetter2"><input type="radio" id="ltrScnCd" name="ltrScnCd" value="B" /><span class="letter2">편지지B</span></label>
                                <label for="chckLetter3"><input type="radio" id="ltrScnCd" name="ltrScnCd" value="C" /><span class="letter3">편지지C</span></label>
                            </span>
                        </td>
                    </tr>
                    
                    <tr>
                        <th><sup>*</sup>내용</th>
                        <td colspan="3">
                            <textarea rows="25" cols="85" id="sbc" name="sbc">${result.sbc }</textarea>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>
            <div class="btnBoard">
                <span class="flow">
                    <a href="#" id="listButn">목록</a>
                </span>
                <span class="reverse">
                    <input type="submit" id="rgstButn" title="등록" value="등록" />
                    <a href="#" id="cnclButn" >취소</a>
                </span>
            </div>
        </div>
    <%
    // 등록 process 를 위한 iFrame Start
    %>
    <iframe name="comIframe" id="comIframe" src="about:blank" height="0" width="0"></iframe>
    <%
    // 등록 process 를 위한 iFrame END
    %>
</div>
</body>
</html>